package com.csdj.game.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * author:cloud
 * date:2021/3/30 0030
 **/
@Controller
@ControllerAdvice
public class ExceptionController {

    @ExceptionHandler(RuntimeException.class)
    public ModelAndView error(RuntimeException e){
        e.printStackTrace();
        ModelAndView modelAndView = new ModelAndView("error");
        modelAndView.addObject("errMsg",e.getMessage());
        return modelAndView;
    }
}
